Class BunnyMaskModel extends Actor;

var Pawn PawnOwner;
var StaticMesh MaskMesh;
var vector RelativePos;
var rotator RelativeRot;
var float Scaling;

replication
{
	// Variables the server should send to the client.
	reliable if( Role==ROLE_Authority )
		PawnOwner;
}

simulated function PostNetBeginPlay()
{
	if( Level.NetMode==NM_Client )
	{
		if( PawnOwner!=None )
			SetModel();
		else
		{
			Disable('Tick');
			bNetNotify = true;
		}
	}
}
simulated function PostNetReceive()
{
	if( PawnOwner!=None )
	{
		SetModel();
		bNetNotify = false;
		Enable('Tick');
	}
}

simulated final function SetModel()
{
	if( Level.NetMode!=NM_DedicatedServer )
	{
		SetStaticMesh(MaskMesh);
		SetDrawScale(Scaling);
		PawnOwner.AttachToBone(Self,PawnOwner.HeadBone);
		SetRelativeLocation(RelativePos);
		SetRelativeRotation(RelativeRot);
	}
	else SetBase(PawnOwner);
}
simulated function Tick( float Delta )
{
	if( PawnOwner==None )
		Destroy();
	else if( Level.NetMode!=NM_Client && PawnOwner.Health<=0 )
	{
		bTearOff = true;
		LifeSpan = 1.f;
		Disable('Tick');
	}
}
simulated function TornOff()
{
	if( bNetNotify )
		Destroy();
}

final function bool HatMatches( Pawn Target )
{
	return (Target==PawnOwner);
}

defaultproperties
{
     MaskMesh=StaticMesh'SlotsAddOn_SM.FrankBunnyMask'
     RelativePos=(Y=1.000000)
     RelativeRot=(Pitch=-16384)
     Scaling=0.650000
     DrawType=DT_StaticMesh
     bDramaticLighting=True
     bSkipActorPropertyReplication=True
     RemoteRole=ROLE_SimulatedProxy
     bHardAttach=True
     bNoRepMesh=True
}
